package cc.wsyw126.java.nowcoder.sword_offer;

/**
 * Created by dp on 17/3/27.
 */
public class RectCover {
    private int[] memory = new int[4000];

    {
        memory[0] = 0;
        memory[1] = 1;
        memory[2] = 2;
        for (int i = 3; i < memory.length; i++) {
            memory[i] = Integer.MAX_VALUE;
        }
    }
    public int JumpFloor(int n) {
        if (memory[n] == Integer.MAX_VALUE) {
            int result = JumpFloor(n-1) + JumpFloor(n-2);
            memory[n] = result;
        }
        return memory[n];
    }

    public static void main(String[] args) {
        RectCover jumpFloor = new RectCover();
        int i = jumpFloor.JumpFloor(1);
        System.out.println("i = " + i);
    }
}
